#ifndef SPI_DRIVER_HPP
#define SPI_DRIVER_HPP

#include "driver/spi_master.h"

class SPIDriver {
public:
    SPIDriver();
    SPIDriver(int mosi, int miso, int sclk, spi_host_device_t spi_host);
    ~SPIDriver();
    
    void init(int mosi, int miso, int sclk, spi_host_device_t spi_host);
    void setClockSpeed(int speed);
    void addDevice(int cs);
    bool writeByte(const uint8_t *data, size_t length);
    bool readByte(uint8_t *data, size_t length);

private:
    int m_clock_speed_hz;
    spi_host_device_t m_spi_host;
    spi_device_handle_t m_spi_dev;
};

#endif // SPI_DRIVER_HPP
